<extend name="Public/base" />
	<block name="wrapper">
		<form action="{:U('Auser/insert')}" method="post" enctype="multipart/form-data">
			<table class="table">
			  <tr>
			  	<th>用户名</th>
			  	<td><input type="text" name="username"></td>
			  </tr>
			  <tr>
			  	<th>密码</th>
			  	<td><input type="password" name="userpwd"></td>
			  </tr>
			  <tr>
			  	<th>密码确认</th>
			  	<td><input type="password" name="qruserpwd"></td>
			  </tr>
			  <tr>
			  	<th>上传图像</th>
			  	<td>
			  		<input id="brows" type="file" name="userpic">
					<div id="box" ></div>
			  	</td>
			  </tr>
			  <tr>
			  	<th ><input type="submit" value="添加管理员"></th>
			  </tr>
			</table>
		</form>
		<script src="__PUBLIC__/js/Plupload/plupload.full.min.js"></script>
		<script src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>
		
		<script>
		var upload = new plupload.Uploader({
			//指定文件上传的按钮的id值
			browse_button:'brows',

			//指定服务器的ip地址
			url:"{:U('Auser/upload')}",

		});

		//2.初始化文件上传对象
		upload.init();

		//3.执行文件上传，当文件添加的时候就执行
		upload.bind('FilesAdded',function(uploader,files){
			//文件开始上传
			upload.start();
		});

		//4.文件上传成功后执行的方法
		upload.bind('FileUploaded',function(uploader,file,responseObject){

			if(responseObject.status==200){
				var picname = responseObject.response;

				// $('#box').html('<img id="girl" src="__PUBLIC__/'+responseObject.response+'" alt="" />');
				//console.log(picname);
				$('#box').html('<img width="100" height="100" id="girl" src="__PUBLIC__/'+responseObject.response+'" alt="" />');
				 //console.log('<img src="__PUBLIC__/'+picname+'"/>');
			}
		});
		</script>
	</block>
	